package com.iwhalecloud.bss.kite.cucc.service.job.collectiongroup;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.iwhalecloud.bss.kite.cucc.client.api.job.collectiongroup.IKiteGroupDetailLogService;
import com.iwhalecloud.bss.kite.cucc.client.dto.order.KiteGroupDetailLog;
import com.iwhalecloud.bss.kite.cucc.dataservice.mapper.collection.KiteGroupDetailLogMapper;

import com.ztesoft.bss.common.util.SpringUtil;

/**
 * Created by huanghaosheng on 2021/3/3 9:38
 */
@Service
public class KiteGroupDetailLogService implements IKiteGroupDetailLogService {

    @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
    @Override
    public List<KiteGroupDetailLog> listKiteGroupDetailLog(String importType, String checkStatus, Integer num) {
        KiteGroupDetailLogMapper kiteGroupDetailLogMapper = SpringUtil.getBean(KiteGroupDetailLogMapper.class);
        return kiteGroupDetailLogMapper.listKiteGroupDetailLog(importType, checkStatus, num);
    }

    @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
    @Override
    public List<Map<String, Object>> listKiteGroupInfoForMap(String importType, String checkStatus, Integer num) {
        KiteGroupDetailLogMapper kiteGroupDetailLogMapper = SpringUtil.getBean(KiteGroupDetailLogMapper.class);
        return kiteGroupDetailLogMapper.listKiteGroupInfoForMap(importType, checkStatus, num);
    }

    @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
    @Override
    public void updateKiteGroupDetailLogCheckStatus(String checkStatus, Long detailId, String checkResult) {
        KiteGroupDetailLogMapper kiteGroupDetailLogMapper = SpringUtil.getBean(KiteGroupDetailLogMapper.class);
        kiteGroupDetailLogMapper.updateKiteGroupDetailLogCheckStatus(checkStatus, detailId, checkResult);
    }

    @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
    @Override
    public void updateKiteGroupDetailLogStatus(String statusCd, Long detailId, String dealDesc) {
        KiteGroupDetailLogMapper kiteGroupDetailLogMapper = SpringUtil.getBean(KiteGroupDetailLogMapper.class);
        kiteGroupDetailLogMapper.updateKiteGroupDetailLogStatus(statusCd, detailId, dealDesc);
    }
}
